add: automated release flow for widgets/packages, and event dispatch for automated wallet integration trigger - #131
add: automated release flow for widgets/packages, and event dispatch for automated wallet integration trigger#131L03TJ3 wants to merge 2 commits into
Conversation
…for automated wallet integration trigger
There was a problem hiding this comment.
Pull request overview
This PR introduces a production release pipeline for GoodWidget packages/widgets (versioning → build/pack/publish → tag → optional GoodWallet dispatch), and formalizes a widget integration manifest contract validated in CI. It also updates widget register entry points to be SSR-safe by deferring browser-only imports until a Custom Elements runtime is detected.
Changes:
- Add release tooling (
scripts/release/*) plus GitHub Actions workflows to validate, promote, release, and recover npm publications. - Introduce a v2 widget integration manifest schema + per-widget
integration-manifest.json, and enforce package publication metadata consistency. - Make widget
registerentry points SSR-safe (dynamic element imports + DOM guards) and adjust embed/core/ui packaging details to support safe package inspection.
Reviewed changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/release/validate-register-entries.mjs | Validates that every production widget ./register export is SSR-safe for both ESM and CJS builds. |
| scripts/release/validate-packages.mjs | Enforces consistent npm metadata (license, repo, publishConfig) across production packages and checks repository LICENSE. |
| scripts/release/validate-manifests.test.mjs | Adds unit tests for manifest validation and release-envelope creation logic. |
| scripts/release/validate-manifests.mjs | Implements schema + contract validation for widget integration manifests and release-envelope creation. |
| scripts/release/release.mjs | Adds automated versioning, packing, publishing, tagging, verification, and optional GoodWallet dispatch. |
| scripts/release/packages.test.mjs | Tests release relevance and dependency-cascade selection logic for the production allowlist. |
| scripts/release/packages.mjs | Defines the production allowlist + dependency graph and release-relevance rules. |
| schemas/widget-integration-manifest.schema.json | Adds JSON Schema (draft 2020-12) for integration manifest v2. |
| pnpm-lock.yaml | Locks Ajv version and updates workspace protocol ranges used by packages. |
| packages/ui/src/components-test/Select.tsx | Removes an unused Tamagui type import. |
| packages/ui/src/components-test/Input.tsx | Ensures both onChange and onChangeText are forwarded to the input frame. |
| packages/ui/src/clipboard.ts | Removes an unused type definition. |
| packages/ui/package.json | Adds publish metadata (license/repo/files/publishConfig/sideEffects) for release validation. |
| packages/streaming-widget/src/register.ts | Makes web-component registration SSR-safe via DOM guard + dynamic import; switches to async register. |
| packages/streaming-widget/package.json | Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges. |
| packages/streaming-widget/integration-manifest.json | Adds v2 integration manifest for the streaming widget. |
| packages/staking-migration-widget/src/register.ts | Makes registration SSR-safe via DOM guard + dynamic import; switches to async register. |
| packages/staking-migration-widget/package.json | Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges. |
| packages/staking-migration-widget/integration-manifest.json | Adds v2 integration manifest for the staking migration widget. |
| packages/governance-widget/package.json | Adds license field. |
| packages/goodreserve-widget/src/register.ts | Makes registration SSR-safe via DOM guard + dynamic import; switches to async register. |
| packages/goodreserve-widget/package.json | Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges. |
| packages/goodreserve-widget/integration-manifest.json | Adds v2 integration manifest for the goodreserve widget. |
| packages/embed/src/createMiniAppElement.tsx | Avoids hard-failing on missing DOM globals during SSR/package inspection; minor filter cleanup. |
| packages/embed/package.json | Adds publish metadata and updates workspace ranges. |
| packages/core/src/detect.ts | Removes unused type import. |
| packages/core/package.json | Adds publish metadata and updates workspace ranges. |
| packages/claim-widget-theme-demo/src/register.ts | Adds a customElements guard (but still statically imports element, which undermines SSR safety). |
| packages/claim-widget-theme-demo/package.json | Adds license field. |
| packages/citizen-claim-widget/src/register.ts | Makes registration SSR-safe via DOM guard + dynamic import; switches to async register. |
| packages/citizen-claim-widget/package.json | Adds publish metadata, integration-manifest export, sideEffects, bumps stable version, updates workspace ranges. |
| packages/citizen-claim-widget/integration-manifest.json | Adds v2 integration manifest for the citizen claim widget. |
| packages/ai-credits-widget/src/register.ts | Makes registration SSR-safe via DOM guard + dynamic import; switches to async register. |
| packages/ai-credits-widget/src/chainClient.ts | Adjusts mock method signatures (currently diverges from interface parameter lists). |
| packages/ai-credits-widget/src/backendClient.ts | Adjusts mock method signatures (currently diverges from interface parameter lists). |
| packages/ai-credits-widget/package.json | Adds publish metadata, integration-manifest export, sideEffects, and updates workspace ranges. |
| packages/ai-credits-widget/integration-manifest.json | Adds v2 integration manifest for the AI credits widget. |
| package.json | Adds MIT license, release/validation scripts, and Ajv devDependency. |
| LICENSE | Adds MIT LICENSE text required by release validation. |
| docs/PACKAGING.md | Updates packaging guidance to recommend SSR-safe async register with dynamic element import. |
| .github/workflows/validate-release.yml | Adds CI workflow to validate release contracts (manifests/packages/register entry SSR safety). |
| .github/workflows/release-next.yml | Adds branch-gated npm release workflow (next-only), including optional GoodWallet dispatch. |
| .github/workflows/recover-release.yml | Adds a recovery workflow to republish/verify an already-committed version. |
| .github/workflows/promote-next.yml | Adds a maintainer-gated workflow to promote main → next. |
| .github/workflows/deploy-storybook.yml | Pins actions by SHA and sets minimal permissions. |
| .github/workflows/deploy-ai-credits-web.yml | Pins actions by SHA and sets minimal permissions. |
| .github/workflows/copilot-setup-steps.yml | Pins actions by SHA for deterministic Copilot setup. |
| .github/CODEOWNERS | Adds maintainers as owners for release automation and integration contract files. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (3)
packages/ai-credits-widget/src/chainClient.ts:313
MockAiCreditsChainClient.getWithdrawableUsdno longer accepts thebuyerparameter, even though the interface requires it. This makes direct calls on the mock type-invalid. Keep the signature consistent and ignore the argument if unused.
async getWithdrawableUsd(): Promise<string> {
return '0'
}
packages/ai-credits-widget/src/backendClient.ts:441
MockAiCreditsBackendClient.closeChanneldropped the optionalbodyparameter even though the interface includes it. This makes it harder to use the mock as a drop-in replacement when code passes request bodies.
async closeChannel(channelId: string): Promise<ChannelOperationResponse> {
await sleep(MOCK_DELAY_MS)
return { channelId, action: 'close', bridge: { enabled: true, txHash: '0xmock' } }
}
packages/ai-credits-widget/src/backendClient.ts:458
MockAiCreditsBackendClient.submitOperatorConsentremoved the requiredbodyparameter, butAiCreditsBackendClient.submitOperatorConsentrequires it (and callers pass it). This prevents using the mock directly without retyping it as the interface. Keep the parameter and ignore it if unused.
async submitOperatorConsent(buyer: string): Promise<OperatorConsentResponse> {
await sleep(MOCK_DELAY_MS)
const normalizedBuyer = normalizeAddress(buyer)
markMockOperatorConsent(normalizedBuyer)
|
@copilot can you produce a pull-request description for the changes proposed |
Updated the PR description with the release flow, required release environment configuration, manifest/SSR packaging changes, and the verification commands. |
|
@copilot Follow up on your comments and resolve:
|
Co-authored-by: L03TJ3 <6606028+L03TJ3@users.noreply.github.com>
Addressed in a2d8ca6. I reverted the unrelated ai-credits mock signature changes, fixed the SSR-safe lazy import for claim-widget-theme-demo/register, and hardened manifest validation so malformed nested objects fail with a clear error. |
Description
This PR adds a guarded production release path for the publishable GoodWidget packages and the wallet-facing widget integration contract that release automation depends on.
Summary
promote-next,release-next, andrecover-releaseworkflows for npm publicationnext, rebuild/package them, publish with provenance, verify npm integrity/latest, tag releases, and optionally notify GoodWalletintegration-manifest.jsonfiles for production widgets, with validation for schema shape, package exports, tarball contents, and npm publication metadata./registerentries SSR-safe so Node/Next.js can inspect published packages without eagerly touching DOM globals, and keep web-component dispatch wiring available for wallet automation after a verified releaseOperational flow
validate-release.ymlruns on PRs that touch release-relevant files and checks the release contract with:pnpm test:releasepnpm lintpnpm buildpnpm validate:register-entriesmainstays the development/deployment branch; onlynextis allowed to publish packages.nexttriggers Release production packages, which:pnpm-lock.yaml./registerexportsnextlatestdist-tagRequired release environment configuration
Protected
releaseenvironment configuration expected by these workflows:NPM_TOKEN— required for npm publicationGOODWALLET_DISPATCH_PAT— required only when GoodWallet repository dispatch is enabledENABLE_GOODWALLET_DISPATCH— protected repository/environment variable gate; dispatch remains disabled unless this is explicitly set totrueAdditional implementation notes
Related work: #132
How Has This Been Tested?
Release-contract validation added in this PR is exercised through:
pnpm test:releasepnpm lintpnpm buildpnpm validate:register-entriesChecklist: